#include "contactsview.h"

#include <QKeyEvent>
#include <QMouseEvent>
#include <QScrollBar>

ContactsView::ContactsView(QWidget *parent) :
        QListView(parent)
{
    setMouseTracking(true);
    setAcceptMouseClick(this);
}

QPoint ContactsView::scrollOffset() const
{
    return QPoint(0, verticalScrollBar()->value() * 32);
}

void ContactsView::setScrollOffset(const QPoint &offset)
{
    verticalScrollBar()->setValue(offset.y() / 32);
}

void ContactsView::mousePressEvent(QMouseEvent *event)
{
    Flickable::handleMousePress(event);
    QListView::mousePressEvent(event);
}

void ContactsView::mouseMoveEvent(QMouseEvent *event)
{
    Flickable::handleMouseMove(event);
}

void ContactsView::mouseReleaseEvent(QMouseEvent *event)
{
    Flickable::handleMouseRelease(event);
    QListView::mouseReleaseEvent(event);
}
